package com.example.reference_book.filter.bookImpl;

import com.example.reference_book.entity.Book;
import com.example.reference_book.filter.BookFilter;

import java.util.ArrayList;
import java.util.List;

public class BookPublisherFilter implements BookFilter {
    @Override
    public List<Book> getBooks(String key,List<Book> bookList) {
        List<Book> res = new ArrayList<>();
        for(int i=0;i< bookList.size();i++){
            if (bookList.get(i).getPublisher().contains(key)){
                res.add(bookList.get(i));
            }
        }
        return res;
    }

}
